<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>sublimetext开发技巧 | It is Home</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="使用lint进行语法及风格的校验
在sublimetext分别安装插件sublimetextLinter和sublimetextlinterjshint两个插件 注：sublimetextLinter是一个框架，安装之后需要再安装相应语言的lint插件，如jshint
安装nodejs，然后全局安装jshint 1npm install -g jshint


3.配置自定义的jshint规则：如">
<meta property="og:type" content="article">
<meta property="og:title" content="sublimetext开发技巧">
<meta property="og:url" content="http://tanhanjay.oschina.io/2017/01/26/sublimetext开发技巧/index.html">
<meta property="og:site_name" content="It is Home">
<meta property="og:description" content="使用lint进行语法及风格的校验
在sublimetext分别安装插件sublimetextLinter和sublimetextlinterjshint两个插件 注：sublimetextLinter是一个框架，安装之后需要再安装相应语言的lint插件，如jshint
安装nodejs，然后全局安装jshint 1npm install -g jshint


3.配置自定义的jshint规则：如">
<meta property="og:updated_time" content="2017-01-26T13:01:49.931Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="sublimetext开发技巧">
<meta name="twitter:description" content="使用lint进行语法及风格的校验
在sublimetext分别安装插件sublimetextLinter和sublimetextlinterjshint两个插件 注：sublimetextLinter是一个框架，安装之后需要再安装相应语言的lint插件，如jshint
安装nodejs，然后全局安装jshint 1npm install -g jshint


3.配置自定义的jshint规则：如">
  
    <link rel="alternate" href="/atom.xml" title="It is Home" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link rel="stylesheet" href="/css/style.css">
  

</head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">It is Home</a>
      </h1>
      
        <h2 id="subtitle-wrap">
          <a href="/" id="subtitle">Welcome to my blog!</a>
        </h2>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="搜索"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" results="0" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://tanhanjay.oschina.io"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main"><article id="post-sublimetext开发技巧" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2017/01/26/sublimetext开发技巧/" class="article-date">
  <time datetime="2017-01-26T09:22:24.000Z" itemprop="datePublished">2017-01-26</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      sublimetext开发技巧
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h2 id="使用lint进行语法及风格的校验"><a href="#使用lint进行语法及风格的校验" class="headerlink" title="使用lint进行语法及风格的校验"></a>使用lint进行语法及风格的校验</h2><ol>
<li>在sublimetext分别安装插件sublimetextLinter和sublimetextlinterjshint两个插件<br> 注：sublimetextLinter是一个框架，安装之后需要再安装相应语言的lint插件，如jshint</li>
<li>安装nodejs，然后全局安装jshint <figure class="highlight cmd"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm install -g jshint</div></pre></td></tr></table></figure>
</li>
</ol>
<p>3.配置自定义的jshint规则：<br>如：js中<br><figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">var</span> x = <span class="number">123</span>;</div><div class="line"><span class="keyword">var</span> y = <span class="string">'123'</span>;</div><div class="line"><span class="keyword">if</span>(x == y)&#123;</div><div class="line">	cosole.log(<span class="string">'x equal y'</span>);</div><div class="line">&#125;</div></pre></td></tr></table></figure></p>
<p>有时可能会得到正确的结果，有时却不能，因为数字和字符串的比较是毫无意义的<br>我们最好使用 === 来进行比较，但是写 == lint系统是很难发现的，这时我们可以使用lint系统的自定义来找出这样的错误<br>我们可以按照如下步骤配置：  </p>
<ul>
<li>在项目目录中新建.jshintra文件来配置<figure class="highlight json"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">&#123;</div><div class="line"><span class="attr">"eqeqeq"</span>:<span class="literal">true</span> </div><div class="line">&#125;</div></pre></td></tr></table></figure>
</li>
</ul>
<p>在 <a href="http://jshint.com/docs/options" target="_blank" rel="external">jshint的网站</a>中查看详细的配置项和用法</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://tanhanjay.oschina.io/2017/01/26/sublimetext开发技巧/" data-id="cj26ay9mg0007mwxajncwwie2" class="article-share-link">Share</a>
      
      
    </footer>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/2017/02/01/中南OJ题记录/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Newer</strong>
      <div class="article-nav-title">
        
          中南OJ题记录
        
      </div>
    </a>
  
  
    <a href="/2017/01/24/Ionic2配置过程/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Older</strong>
      <div class="article-nav-title">Ionic2配置过程</div>
    </a>
  
</nav>

  
</article>

</section>
        
          <aside id="sidebar">
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">分类</h3>
    <div class="widget">
      <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/开发/">开发</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/考研/">考研</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">标签</h3>
    <div class="widget">
      <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/考研/">考研</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">标签云</h3>
    <div class="widget tagcloud">
      <a href="/tags/考研/" style="font-size: 10px;">考研</a>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">归档</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/03/">三月 2017</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/02/">二月 2017</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/01/">一月 2017</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">最新文章</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2017/03/31/angular学习笔记/">angular学习笔记</a>
          </li>
        
          <li>
            <a href="/2017/02/02/SublimeText的常用插件及问题/">SublimeText的常用插件及问题</a>
          </li>
        
          <li>
            <a href="/2017/02/01/中南OJ题记录/">中南OJ题记录</a>
          </li>
        
          <li>
            <a href="/2017/01/26/sublimetext开发技巧/">sublimetext开发技巧</a>
          </li>
        
          <li>
            <a href="/2017/01/24/Ionic2配置过程/">Ionic2配置过程</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2017 tanhanjay<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  <script src="/fancybox/jquery.fancybox.pack.js"></script>


<script src="/js/script.js"></script>

  </div>
</body>
</html>